package newcrunch.grader;

import java.io.IOException;
import java.io.UnsupportedEncodingException;

/**
 *
 * @author ccadm
 */
public class SubmissionProcessor 
{
    private String gradedCode;
    private String comments;
    private String[] marks;
    
    //typographical analysis data
    private String[] results;
    private String[] standardDeviation;
    private String[] commentsArr;
    
    public SubmissionProcessor() 
    {
    }
    
    public void setMarks(String[] scores)
    {
        marks = scores;
    }
    
    public void setGradedCode(String text)
    {
        gradedCode = text;
    }
    
    public void setTypoData(String[] results, String[] standardDeviation, String[] comments)
    {
        this.results = results;
        this.standardDeviation = standardDeviation;
        this.commentsArr = comments;
    }
    
    public void setGraderComments(String comments)
    {
        this.comments = comments;
    }
    
    public void sendSubmission(ConnectionManager access, String submissionId, String filename) throws UnsupportedEncodingException, IOException
    {
        access.sendGradingComment(submissionId, comments);
        access.sendGradedCode(submissionId, gradedCode, filename);
        access.sendMarks(submissionId, marks);
        access.sendTypography(submissionId, results, standardDeviation, commentsArr);
    }
}
